<?php
if (!(defined('IN_IA'))) 
{
	exit('Access Denied');
}
class Index_Page extends WebPage
{
	public function member(){
		
       global $_W,$_GPC;
        $uniacid=$_W['uniacid'];
        $title=$_GPC['title'];
        $where='';
        if($title!=''){
            $where = " and (member_nickname like'%".$title."%' or member_mobile like'%".$title."%' or member_email like'%".$title."%' or member_qq like'%".$title."%')" ;
        }        
        $pindex = max(1, intval($_GPC['page']));
        $psize = 8;
        $sql="select * from ".tablename('bd_member')." where `uniacid`='$uniacid' $where order by member_id desc LIMIT " . ($pindex - 1) * $psize . ",$psize";
        $list=pdo_fetchall($sql);
        $total = pdo_fetchcolumn("select count(*) from ".tablename('bd_member')." where `uniacid`='$uniacid' $where");
        $pager = pagination($total, $pindex, $psize);
        $i = ($pindex - 1) * $psize+1;

        include $this->template();
	}

    /****************批量删除********************************/
	public function member_editall(){
		global $_W,$_GPC;
		$uniacid=$_W['uniacid'];
		if(empty($_GPC['xuanze'])){
            $this->error('未选择数据','',0);
        }
		if($_GPC['piliang'] == 1){
                    //批量删除
			foreach ($_GPC['xuanze'] as $key => $value) {
				$data['member_id']=$value;
                $data['uniacid'] = $uniacid;
                pdo_delete('bd_member',$data);
             }
             $this->success('删除成功','',2);
		}
	}


    /*
    * 删除资讯
     */
    public function member_del(){
        global $_W,$_GPC;
        $uniacid=$_W['uniacid'];
        if($_GPC['member_id']){
            $id=$_GPC['member_id'];
            $data=pdo_delete('bd_member',array('member_id'=>$id,'uniacid'=>$uniacid));
            $this->success('删除成功','member/index/member');
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function guestbook(){
    
        global $_W,$_GPC;
        $uniacid=$_W['uniacid'];
        $title=$_GPC['title'];
        $where='';
        if($title!=''){
            $where = " and (guestbook_content like'%".$title."%' or guestbook_name like'%".$title."%' or guestbook_email like'%".$title."%' or guestbook_tel like'%".$title."%')" ;
        }
        $pindex = max(1, intval($_GPC['page']));
        $psize = 8;
        $sql="select * from ".tablename('bd_cms_guestbook')." where `uniacid`='$uniacid' $where order by guestbook_id desc LIMIT " . ($pindex - 1) * $psize . ",$psize";
        $list=pdo_fetchall($sql);
        $total = pdo_fetchcolumn("select count(*) from ".tablename('bd_cms_guestbook')." where `uniacid`='$uniacid' $where");
        $pager = pagination($total, $pindex, $psize);
        $i = ($pindex - 1) * $psize+1;
    
        include $this->template();
    }
    
    /****************批量删除********************************/
    public function guestbook_editall(){
        global $_W,$_GPC;
        $uniacid=$_W['uniacid'];
        if(empty($_GPC['xuanze'])){
            $this->error('未选择数据','',0);
        }
        if($_GPC['piliang'] == 1){
            //批量删除
            foreach ($_GPC['xuanze'] as $key => $value) {
                $data['guestbook_id']=$value;
                $data['uniacid'] = $uniacid;
                pdo_delete('bd_cms_guestbook',$data);
            }
            $this->success('删除成功','',2);
        }
    }
    
    
    /*
     * 删除资讯
     */
    public function guestbook_del(){
        global $_W,$_GPC;
        $uniacid=$_W['uniacid'];
        if($_GPC['guestbook_id']){
            $id=$_GPC['guestbook_id'];
            $data=pdo_delete('bd_cms_guestbook',array('guestbook_id'=>$id,'uniacid'=>$uniacid));
            $this->success('删除成功','member/index/guestbook');
        }
    }  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    /*
     * 去除富文本内的字体
     * 2018年1月19日13:22:00
     */
    public function fwb_del_font($str){
        $str = htmlspecialchars_decode($str);
        $re = preg_replace("/font-family:.*;/i",'',$str);
        $re = preg_replace("/font-family:.*\"/i",'"',$re);
        return $re;
    }

}

?>